﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using TA.JSON;

namespace TA.Turbo.Controls
{
	public abstract class BaseTextNode : BaseTreeNode
	{
		#region PUBLIC
		#region INIT
		/// <summary>
		/// Ctor.
		/// </summary>
		public BaseTextNode()
		{
			this.Text = "";
			this.ToolTip = "";
		}
		#endregion
		#region EVENTS
		#endregion
		#region PROPS
		[DefaultValue("")]
		public string Text { get; set; }
		[DefaultValue("")]
		public string ToolTip { get; set; }
		#endregion
		#region METHODS
		#endregion
		#endregion
		#region INTERNAL
		#region CONST/STATIC
		#endregion
		#region VARS
		#endregion
		#region PROPS
		#endregion
		#region METHODS
		#region INIT
		#endregion
		#region DATA
		public override void SerializeContents(TA.JSON.JsonWriter jw)
		{
			base.SerializeContents(jw);

			if (!string.IsNullOrEmpty(this.Text))
			{
				jw.PropertyName("Tx");
				jw.Value(this.Text);
			}

			if (!string.IsNullOrEmpty(this.ToolTip))
			{
				jw.PropertyName("T");
				jw.Value(this.ToolTip);
			}
		}
		public override void DeserializeContent(IJsonReader jr, string propShortName)
		{
			switch (propShortName)
			{
				case "Tx": this.Text = (string)jr.Value; break;
				case "T": this.ToolTip = (string)jr.Value; break;
				default: base.DeserializeContent(jr, propShortName); break;
			}			
		}
		#endregion
		#region HANDLERS
		#endregion
		#endregion
		#endregion

	}
}
